import React from 'react'
import { Button, Space, Form, Input, Card, Select, Table } from 'antd'
import { SearchOutlined } from '@ant-design/icons'
import type { ColumnsType } from 'antd/es/table'
// 解构Select组件中的Option组件
const { Option } = Select
export default function HospitalList() {
  const onFinish = (values: any) => {
    console.log('Success:', values)
  }
  const columns: ColumnsType<any> = [
    {
      title: '序号',
      render(a, b, index) {
        return index + 1
      },
      align: 'center',
    },
    {
      title: '医院logo',
      render(a, b, index) {
        return <img src="http://localhost:3001/lsp.jpg" alt="" width="80" />
      },
    },
    {
      title: '医院名称',
    },
    {
      title: '等级',
    },
    {
      title: '详细地址',
    },
    {
      title: '状态',
    },
    {
      title: '创建时间',
    },
    {
      title: '操作',
      render() {
        return (
          <Space>
            <Button type="primary">查看</Button>
            <Button type="primary">排班</Button>
            <Button type="primary">上线</Button>
          </Space>
        )
      },
      width: 180,
    },
  ]
  return (
    <Card>
      <Form name="basic" onFinish={onFinish} layout="inline">
        <Form.Item name="provinceCode">
          <Select
            placeholder="请选择省"
            style={{ width: 200, marginBottom: 20 }}
          >
            <Option value="gd">广东</Option>
          </Select>
        </Form.Item>
        <Form.Item name="cityCode">
          <Select placeholder="请选择市" style={{ width: 200 }}>
            <Option value="sz">深圳</Option>
          </Select>
        </Form.Item>
        <Form.Item name="districtCode">
          <Select placeholder="请选择区" style={{ width: 200 }}>
            <Option value="sz">宝安</Option>
          </Select>
        </Form.Item>
        <Form.Item name="hosname">
          <Input placeholder="医院名称"></Input>
        </Form.Item>
        <Form.Item name="hoscode">
          <Input placeholder="医院编码"></Input>
        </Form.Item>
        <Form.Item name="hostype">
          <Select
            placeholder="医院类型"
            style={{ width: 200, marginBottom: 20 }}
          >
            <Option value="sz">宝安</Option>
          </Select>
        </Form.Item>
        <Form.Item name="status">
          <Select placeholder="医院状态" style={{ width: 200 }}>
            {/* value="0"这样是字符串0. value={0}这样是数字0 */}
            <Option value={0}>未上线</Option>
            <Option value={1}>已上线</Option>
          </Select>
        </Form.Item>

        <Form.Item>
          <Space>
            <Button type="primary" htmlType="submit" icon={<SearchOutlined />}>
              查询
            </Button>
            <Button>清空</Button>
          </Space>
        </Form.Item>
      </Form>
      <Table columns={columns} dataSource={[{}, {}]}></Table>
    </Card>
  )
}
